package com.yvtong.Servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.yvtong.Service.ChanpinxinxiManager;

/**
 * Servlet implementation class Tianjiachanpinxinxi
 */
@WebServlet("/Tianjiachanpinxinxi")
public class Tianjiachanpinxinxi extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Tianjiachanpinxinxi() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		String Chexing=request.getParameter("chexing");
		int chexing=Integer.parseInt(Chexing);
		
		String dongli=request.getParameter("dongli");
		
		String Zuowei=request.getParameter("zuowei");
		int zuowei=Integer.parseInt(Zuowei);
		
		String Chechang=request.getParameter("chechang");
		int cehchang=Integer.parseInt(Chechang);
		
		String yaoqiu=request.getParameter("yaoqiu");
		
		String paifang=request.getParameter("paifang");
		
		String fadongji=request.getParameter("fadongji");
		
		String name=request.getParameter("name");
		
		String img=request.getParameter("img");
		
		ChanpinxinxiManager m=new ChanpinxinxiManager();
		int i=m.tianjia(chexing, dongli, zuowei, cehchang, yaoqiu, paifang, fadongji, name, img);
		
		response.setContentType("text/json");
		response.setCharacterEncoding("UTF-8");
		
		PrintWriter out = response.getWriter();
		out.println(i);
		out.flush();
		out.close();
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
